//
//  wodemovieViewController.m
//  ui豆瓣
//
//  Created by lirui on 16/1/7.
//  Copyright © 2016年 www.lanou3g.com蓝鸥科技. All rights reserved.
//

#import "wodemovieViewController.h"
#import "moviemodel.h"
#import "DataBaseManger.h"
@interface wodemovieViewController ()<UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,retain)UITableView *tableview;
@property(nonatomic, retain)NSMutableArray *arr;
@end

@implementation wodemovieViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [ UIColor redColor];
    self.tableview = [[ UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    _tableview.dataSource = self;
    _tableview.delegate = self;
    [self.view addSubview:_tableview];
    [_tableview registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
    
    DataBaseManger *dbmanger =[ DataBaseManger shareInstance ];
    [dbmanger openDB];
    _arr =[[ DataBaseManger shareInstance] select];
  
    
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _arr.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [ tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];

    //先获取
    NSDictionary *dic = _arr[ indexPath.row];
    cell.textLabel.text = dic[@"title"];
    NSLog(@"%@",dic[@"title"]);
    
    return cell;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
